package com.api.shopapi.mapper;

import com.api.shopapi.entity.CommandCenterStaffRel;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CommandCenterStaffRelMapper {



    @Insert("insert into command_center_staff_rel " +
            "(" +
            "CommandCenterStaffRelCode," +
            "CommandCenterCode," +
            "StaffCode" +
            ") " +
            "values " +
            "(" +
            "#{commandCenterStaffRel.CommandCenterStaffRelCode}," +
            "#{commandCenterStaffRel.CommandCenterCode}," +
            "#{commandCenterStaffRel.StaffCode}" +
            ")" )
    int insert(@Param("commandCenterStaffRel") CommandCenterStaffRel commandCenterStaffRel);


    @Delete("delete from command_center_staff_rel where commandCenterStaffRelCode=#{commandCenterStaffRelCode}")
    int delete(@Param("commandCenterStaffRelCode") String commandCenterStaffRelCode);


    @Select("select * from command_center_staff_rel where commandCenterStaffRelCode=#{commandCenterStaffRelCode} limit 1")
    CommandCenterStaffRel getByCommandCenterStaffRelCode(@Param("commandCenterStaffRelCode") String commandCenterStaffRelCode);


    @Select("select * from command_center_staff_rel where staffCode=#{staffCode} limit 1")
    CommandCenterStaffRel getByStaffCode(@Param("staffCode") String staffCode);

    @Select("select * from command_center_staff_rel where commandCenterCode=#{commandCenterCode}")
    List<CommandCenterStaffRel> ListByCommandCenterCode(@Param("commandCenterCode") String commandCenterCode);


}
